#include "stdafx.h"
#include "Sort.h"
#pragma once; 


const int DefaultSize = 10;
//.h
template <class T> 
class Array            
{
private:
	T  *pT;
   int  iSize;

public:
   Array();
   Array(int number);
   Array(const Array &rhs);
   ~Array() { delete [] pT; }

   // operator =
   Array& operator=(const Array&);

   // get element at position
   T& operator[](int offSet) { return pT[offSet]; }
   const T& operator[](int offSet) const 
       { return pT[offSet]; }

   int getSize() const { return iSize; }

   void sort(Sort<T>* sortStrategy)
   {
	   sortStrategy->sort(*this);
   }
};

// .cpp
template <class T>
Array<T>::Array()
{
	iSize = DefaultSize;
	pT = new T[iSize];
	 for (int i = 0; i<iSize; i++)
      pT[i] = 0;
}

template <class T>
Array<T>::Array(int number)
{
	iSize = number;
	pT = new T[iSize];
	 for (int i = 0; i<iSize; i++)
      pT[i] = 0;
}

template <class T>
Array<T>::Array(const Array &rhs)
{
   iSize = rhs.GetSize();
   pT = new T[iSize];
   for (int i = 0; i<iSize; i++)
      pT[i] = rhs[i];
}

template <class T>
Array<T>& Array<T>::operator=(const Array &rhs)
{
   if (this == &rhs)
      return *this;
   delete [] pT;
   itsSize = rhs.GetSize();
   pT = new T[iSize];
   for (int i = 0; i<iSize; i++)
      pT[i] = rhs[i];
   return *this;
}


